package com.wan37.logic.service.impl;


import com.wan37.logic.dao.UserDao;
import com.wan37.logic.domain.entity.UserDO;
import com.wan37.logic.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author : luoyong
 * @date : 2020-05-27 17:12
 **/
@Service("userService")
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public UserDO getUserByUserId(String userId) {
        UserDO user = userDao.getUserByUserId(userId);
        if (user != null) {
            return user;
        } else {
            return null;
        }
    }

    @Override
    public boolean update(UserDO userDO) {
        return userDao.update(userDO);
    }

    @Override
    public boolean save(UserDO userDO) {
        return userDao.add(userDO);
    }

    @Override
    public boolean delete(UserDO userDO) {
        return userDao.delete(userDO.getUserId());
    }
}
